Select * from T_book where Book_no in (Select Book_no from T_borrow where Borrow_date>'2010-10-31')
go

select Card_name from T_card where Card_no in (select Card_no from T_borrow where Return_date=null)
go

select * from T_book where Qty<5
go

create view View_card as select Card_name,Mobile,Address from T_card
go

CREATE PROCEDURE GetMaxBooks
   @Book_name varchar(100),
	@Loan_qty int output
AS 
Select @Loan_qty=Loan_qty from T_book where Book_name=@Book_name
go